<template>
	<view id='preview' v-show="show">
		<w-icon class='close-btn' name="close-circle-fill" size="24" color="white" @click='close'></w-icon>
		<w-image  width="375" mode='widthFix' :src='src'></w-image>
	</view>
</template>

<script>
	/*
	*图片预览
	*/
	export default {
		name:"w-preview",
		data() {
			return {
				src:null,
				show:false,
			};
		},
		mounted() {
			uni.$on('preview',this.showFn)
		},
		methods:{
			showFn(src){
				this.src=src;
				this.show=true;
			},
			close(){
				this.show=false;
				this.src=''
			}
		}
	}
</script>

<style lang="scss">
#preview{
	width: 750rpx;
	min-height: 100vh;
	position: fixed;
	left: 0;
	top: 0;
	@extend .bg-color-black,.flex,.flex-ai-center;
	z-index: 999;
	
	.close-btn{
		position: fixed;
		z-index: 999;
		top: 100rpx;
		right: 20rpx;
	}
}
</style>